<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>



    <script>
        // 立即执行函数
        (function () {
            var a = 1;
            console.log(a)
            setTimeout(function () {
                console.log(a)
            }, 1000)
        })()

    </script>
    <script>
            (function () {
                var a = 2
                console.log(a)
            })()
    </script>



</body>

</html>